//
//  NSDate+Extension.h
//  恒好租车
//
//  Created by 123 on 15/12/28.
//  Copyright © 2015年 gg. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSDate (Extension)
/**把string换成date*/
+ (NSDate *)stringToDate:(NSString *)str;
/**把date转换成string*/
- (NSString *)convertDateToSting;//到天
- (NSString *)convertDateToMonthSting;//到日
- (NSString *)convertDateToMinusSting;//到分

/**把date转换成时间戳*/
- (NSString *)dateToSp;
//时间戳转时间
+ (NSString *)spToDateString:(NSString *)sp;
+ (NSString *)spToDateMinusString:(NSString *)sp;//精确到分
//时间戳转NSDate
+ (NSDate *)spToDate:(NSString *)sp;


/**比较2个日期之间的差值*/
- (NSDateComponents *)compareToDate:(NSDate *)date;

/**当前日期增加 几天 几小时*/
- (NSDate *)addYears:(NSInteger)years days:(NSInteger)days hours:(NSInteger)hours minutes:(NSInteger)minutes;

- (NSDate *)addYears:(NSInteger)years months:(NSInteger)month days:(NSInteger)days hours:(NSInteger)hours minutes:(NSInteger)minutes;

/**时间是否处在某个范围内*/
- (BOOL)isBetweenFromHour:(NSInteger)fromHour toHour:(NSInteger)toHour;
@end
